#include<bits/stdc++.h>
using namespace std;

int arr[15][15];
int main(){
    int n;
    cin>>n;

    int k = 1;
    int x = 1;
    int y = 0;
    while(k <= n*n){
        while(y<n && !arr[x][y+1]) arr[x][++y] = k++;//右
        while(x<n && !arr[x+1][y]) arr[++x][y] = k++;//下
        while(y>1 && !arr[x][y-1]) arr[x][--y] = k++;//左
        while(x>1 && !arr[x-1][y]) arr[--x][y] = k++;//上
    }
    for(int i  =1;i<=n;i++){
        for(int j = 1;j<=n;j++){
            printf("%3d",arr[i][j]);
        }
        cout<<endl;
    }
    return 0;
}